import javax.swing.*;
import java.util.Random;

public class test4 {
    public static void main(String[] args) {
        //产生随机数验证码
        //从A到Z
        //从a到z

        //分析
        //1 把大写字母和小写字母放进一个数组在进行抽取
        char[] chs = new char[52];
        for (int i = 0; i < chs.length; i++) {
            if (i <= 25) {
                chs[i] = (char) (97 + i);
            } else {
                chs[i] = (char) (65 + i - 26);
            }
        }

        //定义字符串类型的变量
        String result = "";
        //随机抽取
        Random r = new Random();
        // 2生成随机索引 以此来获取随机值
        for (int i = 0; i < 4; i++) {
            int randomIndex = r.nextInt(chs.length);
            result = result + chs[randomIndex];
        }
//        System.out.println(result);

        //随机生成数字0到9
        int number = r.nextInt(10);
        result = result + number;
        System.out.println(result);
    }
}
